'''
* This is the projet for Brtc LlmOps Platform
* @Author Leon-liao <liaosiliang@alltman.com>
* @Description //TODO 
* @File: 15_simple_use_runnable_passthrough.py
* @Time: 2025/10/23
* @All Rights Reserve By Brtc
'''
import dotenv
from langchain_core.output_parsers import StrOutputParser
from langchain_core.prompts import ChatPromptTemplate
from langchain_core.runnables import RunnablePassthrough
from langchain_openai import ChatOpenAI

dotenv.load_dotenv()

#1、编排prompt
prompt = ChatPromptTemplate.from_template("{query}")

#2、构建大模型
llm = ChatOpenAI(model="gpt-4o-mini")

#3、创建链
chain = {"query":RunnablePassthrough()}|prompt|llm|StrOutputParser()

#4、调用
content = chain.invoke("你好你是？")
print(content)